<template>

  <!--非移动端时显示-->
  <div v-if="ismobile == 0" style="width:100%;height:100vh;display: flex;justify-content: center;">
    <div style="width:36%;min-width:360px;height:100%;overflow: hidden;background: #ffff00;">
      <Home />
    </div>
  </div>
  <!--移动端时显示-->
  <Home v-if="ismobile == 1" />
</template>

<script>
import {ref} from "vue";
//import HelloWorld from './components/HelloWorld.vue'
import Home from './components/Home.vue'
export default {
  name: 'App',
  components: {
    Home
  },
  setup() {
    //是否移动端
    const ismobile = ref(0);
    //判断是否移动端的函数
    const isMobileFunc = () => {
      let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
      if (flag === null) {
        return 0;
      } else {
        return 1;
      }
    };
    if (isMobileFunc() === 1) {
      ismobile.value = 1;
    } else {
      ismobile.value = 0;
    }
    return {
      ismobile,
      isMobileFunc,
    };
  },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /*text-align: center;*/
  color: #2c3e50;
  /*margin-top: 60px;*/
}
body {
  display: block;
  margin: 0px;
}
</style>
